package com.lineage.server.clientpackets;

import com.lineage.echo.ClientExecutor;
import com.lineage.server.model.Instance.L1PcInstance;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class C_LoginToServerOK extends ClientBasePacket {
  private static final Log _log = LogFactory.getLog(C_LoginToServerOK.class);
  
  public void start(byte[] decrypt, ClientExecutor client) {
    try {
      read(decrypt);
      int type = readC();
      int button = readC();
      L1PcInstance pc = client.getActiveChar();
      switch (type) {
        case 255:
          switch (button) {
            case 95:
            case 127:
              pc.setShowWorldChat(true);
              pc.setCanWhisper(true);
              break;
            case 91:
            case 123:
              pc.setShowWorldChat(true);
              pc.setCanWhisper(false);
              break;
            case 94:
            case 126:
              pc.setShowWorldChat(false);
              pc.setCanWhisper(true);
              break;
            case 90:
            case 122:
              pc.setShowWorldChat(false);
              pc.setCanWhisper(false);
              break;
          } 
          break;
        case 0:
          if (button == 0) {
            pc.setShowWorldChat(false);
            break;
          } 
          if (button == 1)
            pc.setShowWorldChat(true); 
          break;
        case 2:
          if (button == 0) {
            pc.setCanWhisper(false);
            break;
          } 
          if (button == 1)
            pc.setCanWhisper(true); 
          break;
        case 6:
          if (button == 0) {
            pc.setShowTradeChat(false);
            break;
          } 
          if (button == 1)
            pc.setShowTradeChat(true); 
          break;
      } 
    } catch (Exception exception) {
    
    } finally {
      over();
    } 
  }
  
  public String getType() {
    return getClass().getSimpleName();
  }
}
